CFE-3866: Allowed select_region to converge across passes#6072
CFE-3866: Allowed select_region to converge across passes#6072nickanderson merged 4 commits intocfengine:masterfrom
Conversation
Together with cfengine/core#6072
|
@cf-bottom jenkins please |
|
Alright, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/13532/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-13532/ |
…sing sections This test demonstrates the bug where set_variable_values_ini() emits 'could not select an edit region' errors when called on a file where the promised section doesn't exist yet. The test creates an empty file and uses set_variable_values_ini() to add a section with keys. Without the fix, this produces multiple errors even though the section is created by the same bundle. Together with cfengine/core#6072 Ticket: CFE-3866
craigcomstock
left a comment
There was a problem hiding this comment.
looks reasonable to me. probably rework your commits to never include a libntech bump.
|
@olehermanse I believe that the acceptance test failures are relating to the test |
8e1c82e to
d708fde
Compare
@nickanderson @craigcomstock sounds like, and looks like, acceptance tests job is missing a "together" step, while other workflows like valgrind_tests have it. |
Commits re-worked and suggestions integrated.
624093b to
09294e5
Compare
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
This test validates that select_region can converge across multiple edit_line passes when the region is created in an earlier pass. The test creates a file with a [section] header in the first promise, then uses select_region to insert content within that section in the second promise. This demonstrates that select_region failures are retried across multiple passes until they succeed. Ticket: CFE-3866 Changelog: None
Modified edit_line operations to allow select_region to succeed across multiple convergence passes. Previously, if a promise inserted a section header in pass 1, promises using select_region for that section would fail with INTERRUPTED in the same run, preventing convergence. Changes: - Added EDIT_CONTEXT_IS_FINAL_PASS macro to files_edit.h for checking if we're on the final convergence pass - Extracted HandleSelectRegionFailure() to centralize error handling for SelectRegion failures across VerifyLineDeletions, VerifyColumnEdits, VerifyPatterns, and VerifyLineInsertions - On non-final passes: log verbose message and return NOOP to allow retry - On final pass: report error with detailed context - Log messages now show remaining passes (e.g., "pass 1/3, 2 more passes to try") This eliminates the need for workarounds in set_variable_values_ini() and similar functions that create sections and immediately edit them. Ticket: CFE-3866 Changelog: Title
09294e5 to
1a411a0
Compare
|
@cf-bottom jenkins please |
|
Alright, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/13542/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-13542/ |

Enable select_region to find regions created by earlier promises during
multi-pass convergence. Previously, if a promise inserted a section header
in pass 1, promises using select_region for that section would fail with
INTERRUPTED, preventing convergence.
This allows policies like set_variable_values_ini() to work without the
workarounds currently required in masterfiles.
Ticket: CFE-3866
Changelog: Title